$(function () {
    loadConfirmData("香港");
    //加载下拉框
    // loadProvinceName("confirmArea");

})

//加载数据
function loadConfirmData(name) {
    var pie_chinaFive = echarts.init(document.getElementById("confirmCount"), 'infographic');
    $.ajax({
        url:"../info/queryTopFiveConfrimByName",
        dataType:"json",
        type:"post",
        data:{"provinceName":name},
        success:function (data) {
            option = {
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                        type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                grid: {
                    left: 40,
                    right: 20,
                    top: 30,
                    bottom: 0,
                    containLabel: true
                },

                xAxis: {
                    type: 'value',
                    axisLine: {
                        lineStyle: {
                            color: 'rgba(255,255,255,0)'
                        }
                    },
                    splitLine: {
                        lineStyle: {
                            color: 'rgba(255,255,255,0)'
                        }
                    },
                    axisLabel: {
                        color: "rgba(255,255,255,0)"
                    },
                    boundaryGap: [0, 0.01]
                },
                yAxis: {
                    type: 'category',
                    axisLine: {
                        lineStyle: {
                            color: 'rgba(255,255,255,5)'
                        }
                    },
                    splitLine: {
                        lineStyle: {
                            color: 'rgba(255,255,255,1)'
                        }
                    },
                    axisLabel: {
                        color: "red"
                    },
                    // data: ['成都','绵阳', '乐山'],
                    data: data[0],
                },
                series: [
                    {
                        // name: '2021-02-18',
                        name: data[1],
                        type: 'bar',
                        barWidth: 20,
                        itemStyle: {
                            normal: {
                                color: 'blue',
                                opacity: 1,
                                barBorderRadius: 5,
                            }
                        },
                        // data: [11,22,33],
                        data: data[2],
                    }
                ]
            };
            pie_chinaFive.setOption(option);
        },error:function () {
            layer.alert("服务器错误");
        }
    })
}
function selectAreaByConfirm() {
    var provinceName=$("#confirmArea").val();
    loadConfirmData(provinceName);
}


